<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input {
            width: 30px;
            padding: 0;
            border: 1px solid rgba(0,0,0,0.8);
            text-align: center;
        }


    </style>
</head>
<body>
    <!-- 计时器，到三分钟停止 -->
    minutes: <input type="text" value="00">
    seconds:  <input type="text" value="00">

    <script>

        var input = document.getElementsByTagName('input');
        var minutes = input[0];
        var seconds = input[1];
        // console.log(seconds.value, typeof(seconds.value));
        var timer = setInterval(function(){
            if(parseInt(seconds.value) < 9){
                seconds.value = "0" + (parseInt(seconds.value) + 1);
            }else{
                seconds.value = parseInt(seconds.value) + 1 +"";
            }

            if(seconds.value == "60"){
                seconds.value = '00';
                minutes.value = "0" + (parseInt(minutes.value) + 1);
            }

            if(minutes.value === '03'){
                clearInterval(timer);
            }

        }, 1000);



    </script>
</body>
</html>